home *** CD-ROM | disk | FTP | other *** search
/ Ultra Gameplayers 101 / Ultra Game Players Magazine, No. 101 - September 1997 (Imagine Publishing, Inc.)(1997).iso / pc / new_ugp.dxr / 00261_Video Display Class.ls < prev    next >
Encoding:
Text File  |  1997-07-10  |  4.4 KB  |  170 lines

  1. property spritenum, spriteLoc, currMemberNum, cleanup, ancestor, killList, hotspotList
  2.  
  3. on new me, parameterList
  4.   set killList to []
  5.   set hotspotList to []
  6.   set spritenum to getProp(parameterList, #spritenum)
  7.   set cleanup to getProp(parameterList, #cleanup)
  8.   set currMemberNum to 0
  9.   set spriteLoc to the loc of sprite spritenum
  10.   puppetSprite(spritenum, 1)
  11.   set the locV of sprite spritenum to -1000
  12.   set the movieRate of sprite spritenum to 0
  13.   set the movieTime of sprite spritenum to 1
  14.   set the stageColor to the stageColor
  15.   updateStage()
  16.   set the visible of sprite spritenum to 1
  17.   updateStage()
  18.   set controlSprite to getaProp(parameterList, #playSprite)
  19.   if controlSprite > 0 then
  20.     repeat with control in [#play, #stop, #slow, #fwdframe, #backframe]
  21.       set button to BasicButton(me, [#hotSprites: [controlSprite]])
  22.       AddDown(button, NewObject(me, "Video Control Class", [#videoControl: control, #videoDisplay: me]))
  23.       set controlSprite to controlSprite + 1
  24.     end repeat
  25.   end if
  26.   return me
  27. end
  28.  
  29. on init me, newVidMember
  30.   put "Init video" && newVidMember
  31.   set audioController to the audioController of GetGlobal(#gTitleObject)
  32.   SuspendAudio(audioController)
  33.   if newVidMember <= 0 then
  34.     put "Bad video member"
  35.     stop(me)
  36.     set the stageColor to the stageColor
  37.     updateStage()
  38.   else
  39.     set currMemberNum to newVidMember
  40.     set the loc of sprite spritenum to spriteLoc
  41.     set the memberNum of sprite spritenum to currMemberNum
  42.     set the visible of sprite spritenum to 1
  43.     set the movieRate of sprite spritenum to 0
  44.     set the movieTime of sprite spritenum to 1
  45.     set the stageColor to the stageColor
  46.     updateStage()
  47.     play(me)
  48.   end if
  49. end
  50.  
  51. on play me
  52.   put "Play"
  53.   set audioController to the audioController of GetGlobal(#gTitleObject)
  54.   SuspendAudio(audioController)
  55.   if currMemberNum > 0 then
  56.     set the movieRate of sprite spritenum to 1
  57.     updateStage()
  58.     put "Playing movie" && the name of member the memberNum of sprite spritenum
  59.   else
  60.     put "No video to play"
  61.   end if
  62. end
  63.  
  64. on slow me
  65.   put "Slow"
  66.   set audioController to the audioController of GetGlobal(#gTitleObject)
  67.   SuspendAudio(audioController)
  68.   if currMemberNum > 0 then
  69.     set the movieRate of sprite spritenum to 0.5
  70.     updateStage()
  71.   else
  72.     put "No video to play"
  73.   end if
  74. end
  75.  
  76. on stop me
  77.   put "Stop"
  78.   if currMemberNum > 0 then
  79.     set the movieRate of sprite spritenum to 0
  80.     if cleanup then
  81.       set the locV of sprite spritenum to -1000
  82.     end if
  83.     set the stageColor to the stageColor
  84.     updateStage()
  85.   else
  86.     put "No video to play"
  87.   end if
  88.   set audioController to the audioController of GetGlobal(#gTitleObject)
  89.   ResumeAudio(audioController)
  90. end
  91.  
  92. on fwdframe me
  93.   put "FwdFrame"
  94.   if currMemberNum > 0 then
  95.     set the movieRate of sprite spritenum to 0
  96.     set newTime to the movieTime of sprite spritenum + 3
  97.     set endTime to the duration of member currMemberNum
  98.     if newTime < 1 then
  99.       set newTime to 1
  100.     end if
  101.     if newTime > endTime then
  102.       set newTime to endTime
  103.     end if
  104.     set the movieTime of sprite spritenum to newTime
  105.     updateStage()
  106.   else
  107.     put "No video to play"
  108.   end if
  109. end
  110.  
  111. on backframe me
  112.   put "BackFrame"
  113.   if currMemberNum > 0 then
  114.     set the movieRate of sprite spritenum to 0
  115.     set newTime to the movieTime of sprite spritenum - 3
  116.     set endTime to the duration of member currMemberNum
  117.     if newTime < 1 then
  118.       set newTime to 1
  119.     end if
  120.     if newTime > endTime then
  121.       set newTime to endTime
  122.     end if
  123.     set the movieTime of sprite spritenum to newTime
  124.     updateStage()
  125.   else
  126.     put "No video to play"
  127.   end if
  128. end
  129.  
  130. on rewind me
  131.   put "rewind"
  132.   set the movieRate of sprite spritenum to 0
  133.   set the movieTime of sprite spritenum to 1
  134.   updateStage()
  135. end
  136.  
  137. on clear me
  138.   put "clear video"
  139.   stop(me)
  140.   updateStage()
  141. end
  142.  
  143. on CheckIdle me
  144.   if the movieRate of sprite spritenum = 0 then
  145.     if cleanup then
  146.       set the locV of sprite spritenum to -1000
  147.     end if
  148.     set the stageColor to the stageColor
  149.     updateStage()
  150.     set audioController to the audioController of GetGlobal(#gTitleObject)
  151.     ResumeAudio(audioController)
  152.   end if
  153. end
  154.  
  155. on dispose me
  156.   put "dispose Video Display Class" && me
  157.   stop(me)
  158.   set currMemberNum to 0
  159.   set the memberNum of sprite spritenum to currMemberNum
  160.   puppetSprite(spritenum, 0)
  161.   set hotspotList to []
  162.   set spriteLoc to 0
  163.   ClearObjectList(killList)
  164.   set killList to []
  165.   if objectp(ancestor) then
  166.     dispose(ancestor)
  167.   end if
  168.   set ancestor to 0
  169. end
  170.